<template>
  <el-dialog :visible.sync="kc22Dialog" :close-on-click-modal="false" :before-close="detailCancel" :fullscreen="kc22Dialog" @close="detailCancel">
    <div class="app-container">
      <!--工具栏-->
      <div class="head-container">
        <div>
          <!--工具栏-->
          <!-- 搜索 -->
          <el-date-picker v-model="query.akc221" clearable size="small" placeholder="开方日期" style="width: 150px;" type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" class="filter-item" @keyup.enter.native="crud.toQuery" />
          <el-input v-model="query.akc222" clearable size="small" placeholder="收费项目编码" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
          <el-input v-model="query.akc223" clearable size="small" placeholder="收费项目名称" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
          <rrOperation :crud="crud" />
        </div>
        <!--表格渲染-->
        <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
          <el-table-column type="selection" width="55" />
          <el-table-column prop="akc190" label="住院编码" align="center" width="100px" />
          <el-table-column prop="akc221" label="处方日期" align="center" width="100px" />
          <el-table-column prop="akc222" label="收费项目编码" align="center" width="140px" />
          <el-table-column prop="akc223" label="收费项目名称" align="center" width="250px" />
          <el-table-column prop="akc225" label="单价" align="center" width="90px" />
          <el-table-column prop="akc226" label="数量" align="center" width="90px" />
          <el-table-column prop="akc227" label="金额" align="center" width="90px" />
          <el-table-column prop="akc228" label="自理金额" align="center" width="130px" />
          <el-table-column prop="akc253" label="个人自费金额" align="center" width="100px" />
          <el-table-column prop="akc220" label="处方号" align="center" width="200px" />
        </el-table>
        <!--分页组件-->
        <pagination />
      </div>
    </div>
  </el-dialog>
</template>

<script>
import crudPggs from '@/api/business/pggs'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import moment from 'moment'
import { mapGetters } from 'vuex'

export default {
  name: 'Kc22',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), crud()],
  dicts: ['ccstcqh'],
  cruds() {
    return CRUD({ title: '费用明细', url: 'api/generalQuery/queryKc22', idField: 'id', sort: ['akc221,asc', 'akc222,asc'], crudMethod: { ...crudPggs }})
  },
  data() {
    return {
      value2: '',
      roleId: 0,
      akc190: '',
      kc22Dialog: false,
      cblxTypeOptions: [
        { key: '职工', display_name: '职工' },
        { key: '居民', display_name: '居民' }
      ],
      zhlbTypeOptions: [
        { key: '9', display_name: '机构' },
        { key: '10', display_name: '居家' }
      ],
      permission: {
        add: ['admin', 'pggs:add'],
        edit: ['admin', 'pggs:edit'],
        del: ['admin', 'pggs:del']
      },
      rules: {
        bisGsglQymc: [
          { required: true, message: '企业名称不能为空', trigger: 'blur' }
        ],
        bisGsglTyshxydm: [
          { required: true, message: '统一社会信用代码不能为空', trigger: 'blur' }
        ],
        bisGsglLxr: [
          { required: true, message: '联系人不能为空', trigger: 'blur' }
        ],
        bisGsglLxrdh: [
          { required: true, message: '联系人电话不能为空', trigger: 'blur' }
        ],
        bisGsglSsqx: [
          { required: true, message: '所属区县不能为空', trigger: 'blur' }
        ],
        bisGsglZcdz: [
          { required: true, message: '注册地址不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'bisGsglQymc', display_name: '企业名称' },
        { key: 'bisGsglTyshxydm', display_name: '统一社会信用代码' },
        { key: 'bisGsglLxr', display_name: '联系人' },
        { key: 'bisGsglLxrdh', display_name: '联系人电话' },
        { key: 'bisGsglSsqx', display_name: '所属区县' },
        { key: 'bisGsglZcdz', display_name: '注册地址' }
      ]
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      console.log('this.query.akc190:', this.query.akc190)
      this.query.akc190 = this.akc190
      return this.kc22Dialog
    },
    detailCancel() {
      this.kc22Dialog = false
    },
    linstensing(d) {
      // query.aae002
      const date1 = moment(d).format('YYYYMM')
      this.query.aae002 = date1
      return date1
    }
  }
}
</script>

<style scoped>

</style>
